package com.csj.picture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csj.picture.api.alinyun.CreateOutPaintingTaskResponse;
import com.csj.picture.model.dto.picture.CreatePictureOutPaintingTaskRequest;
import com.csj.picture.model.dto.picture.PictureQueryRequest;
import com.csj.picture.model.dto.picture.PictureUploadByBatchRequest;
import com.csj.picture.model.dto.picture.PictureUploadRequest;
import com.csj.picture.model.entity.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import com.csj.picture.model.entity.User;
import com.csj.picture.model.vo.PictureVO;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author Lenovo
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-01-21 16:04:45
*/
public interface PictureService extends IService<Picture> {

    /**
     * 上传图片
     *
     * @param multipartFile
     * @param pictureUploadRequest
     * @param loginUser
     * @return
     */
    PictureVO uploadPicture(Object multipartFile,
                            PictureUploadRequest pictureUploadRequest,
                            User loginUser);


    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);

    void validPicture(Picture picture);

    boolean reviewPicture(long id, int reviewStatus, String reviewMessage, User loginUser);

    void fillReviewParams(Picture picture, User loginUser);

    @Async
    void clearPictureFile(List<Picture> oldPicture);

    /**
     * 批量抓取和创建图片
     *
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return 成功创建的图片数
     */
    Integer uploadPictureByBatch(
            PictureUploadByBatchRequest pictureUploadByBatchRequest,
            User loginUser
    );


    void deletePicture(List<Long> pictureId, User loginUser);

    PictureVO uploadPicture2(MultipartFile multipartFile, User loginUser);

    void checkPictureAuth(User loginUser, Picture picture);

    CreateOutPaintingTaskResponse createPictureOutPaintingTask(CreatePictureOutPaintingTaskRequest createPictureOutPaintingTaskRequest, User loginUser);
}
